package com.rerun.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.rerun.entity.Dictionaries;
import com.rerun.entity.DictionariesCategory;
import com.rerun.mapper.DictionariesCategoryMapper;
import com.rerun.mapper.DictionariesMapper;
import com.rerun.service.IDictionariesService;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Service;

/**
 * The type Dictionaries service.
 *
 * @author dax.
 * @version v1.0
 * @since 2017 /9/30 9:27
 */
@Service
public class DictionariesServiceImpl extends ServiceImpl<DictionariesMapper,Dictionaries> implements IDictionariesService {
	@Override
	public List<List<Dictionaries>> selectDictionariesByCode(String name) {
		
		List<Dictionaries> dictionaries = this.baseMapper.selectByCode(name);
		List<List<Dictionaries>> lists = new ArrayList<>();
		if(dictionaries != null && dictionaries.size() > 0) {
			for (Dictionaries d : dictionaries) {
				List<Dictionaries> dictionaries2= this.baseMapper.getDictioaryList(d.getId());
				lists.add(dictionaries2);
			}
			return lists;
		}
		
		return null;
	}

}
